{extend name="public/base" /}
{block name="container"}
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>会员卡充值记录</h5>
						<div style="float: right;">
							<!--  <a  class="btn btn-w-m btn-info" href="{:url('index/member/create')}">添加会员卡</a> -->
						</div>
					</div>
					<div class="ibox-content">
						<div class="row">
							<form action="" method="post">
								<div class="col-sm-3" style="float: right;">
									<div class="input-group">
										<input type="text" placeholder="请输入会员卡号进行记录查询" name="name" class="input-sm form-control"> <span class="input-group-btn">
											<button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
										</div>
									</div>
								</form>
								<div class="col-sm-8">
                                          <!-- <div class="input-group" >
                                            <button class="btn btn-sm btn-primary" onclick="export_data()">导出数据</button>
                                            &emsp;&emsp;&emsp;&emsp;
                                            <button class="btn btn-sm btn-success" onclick="go_public()">转到公海</button>
                                        </div> -->
                                    </div>
                                </div>
                                <div class="table-responsive">
                                	<table class="table table-striped">
                                		<thead>
                                			<tr>
                                				<th></th>
                                				<th>序号</th>
                                				<th>持卡人</th>
                                				<th>卡号</th>
                                				<th>充值金额</th>
                                				<th>赠送金额</th>
                                				<th>赠送积分</th>
                                				<th>操作人</th>
                                				<th>所属店铺</th>
                                				<th>充值时间</th>
                                				<th>操作</th>
                                			</tr>
                                		</thead>
                                		<tbody>
                                			{volist  name="list" id="vo"} 
                                			<tr>
                                				<td><input type="checkbox"  class="i-checks" name="input" value="{$vo.id}"></td>
                                				<td>{$vo.id}</td>
                                				<td>{$vo.card_name}</td>
                                				<td>{$vo.card_num}</td>
                                				<td>{$vo.money}</td>
                                				<td>{$vo.song_money}</td>
                                				<td>{$vo.jifen}</td>
                                				<td>{$vo.entry}</td>
                                				<td>{$vo.shop}</td>
                                				<td>{$vo.add_time|date='Y-m-d H:i',###}</td>
                                				<td style="text-align: center">
                                					<!-- <a href="{:url('index/member/update',array('id'=>$vo['id']))}" title="查看"><i class="iconfont icon-chakan"></i></a>&emsp; -->
                                					<a href="javascript:;" title="删除" onclick="delmember({$vo.id})"><i class="iconfont icon-shanchu"></i></a>
                                				</td>
                                			</tr>
                                			{/volist}
                                		</tbody>
                                	</table>
                                	<div style="float: right;">
                                		{$page}
                                	</div>
                                </div>

                            </div>
                        </div>
                    </div>

                </div>
            </div>

            <div id="modal-form_yundan" class="modal fade" aria-hidden="true">
            	<div class="modal-dialog">
            		<div class="modal-content">
            			<div class="modal-body">
            				<div class="row">
            					<div class="col-sm-12 b-r">
            						<h3 class="m-t-none m-b">添加维护记录：</h3>
            						<form role="form" action="{:url('index/customer/addRow')}" method="post">
            							<div class="form-group">
            								<label class="col-sm-3 control-label" style="text-align: right;">客户意向：</label>
            								<div class="col-sm-9">
            									<select name="yixiang" id="" class="form-control">
            										<option value="-1">--请选择--</option>
            										<option value="-1">--请选择--</option>
            										<option value="A">关键客户</option>
            										<option value="B">主要客户</option>
            										<option value="C">普通客户</option>
            										<option value="D">一般客户</option>
            										<option value="E">死客</option>
            										<option value="F">团购意向客户</option>
            									</select>
            								</div>
            								<label class="col-sm-3 control-label" style="text-align: right;">回访方式：</label>
            								<div class="col-sm-9">
            									<select name="huifang" id="" class="form-control">
            										<option value="-1">--请选择--</option>
            										<option value="1">去电</option>
            										<option value="2">来电</option>
            										<option value="3">上门</option>
            										<option value="4">信息</option>
            									</select>
            								</div>
            								<label class="col-sm-3 control-label" style="margin-top: 10px;text-align: right;">维护记录：</label>
            								<div class="col-sm-9" style="margin-top: 10px;margin-bottom: 30px;">
            									<textarea name="content" id="" cols="30" rows="10" style="resize: none" class="form-control"></textarea>
            									<input type="hidden" id="orderid_yun" name="cust_id" value="">
            								</div>
            							</div>
            							<div>
            								<button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit"><strong>提交</strong>
            								</button>
            							</div>
            						</form>
            					</div>
            				</div>
            			</div>
            		</div>
            	</div>
            </div>
            {/block}
            {block name="js"}
            <!-- Peity -->
            <script src="__INDEX__/js/plugins/peity/jquery.peity.min.js"></script>
            <!-- 自定义js -->
            <script src="__INDEX__/js/content.js?v=1.0.0"></script>
            <!-- iCheck -->
            <script src="__INDEX__/js/plugins/iCheck/icheck.min.js"></script>
            <!-- Peity -->
            <script src="__INDEX__/js/demo/peity-demo.js"></script>
            <script>
            	$(document).ready(function () {
            		$('.i-checks').iCheck({
            			checkboxClass: 'icheckbox_square-green',
            			radioClass: 'iradio_square-green',
            		});
            	});
            </script>
            <script>
            	function getInfo(id)
            	{
            		$.post('{url("index/clothes/uploadZip")}', {id: id}, function(data) {
            			if(data == 3){
            				swal({
            					title: "权限不足",
            					text: "",
            					type: "error"
            				});
            				$('#modal-form').css('display','none'); 
            			}
            		});
            		$("#order_id").val(id);
            		$('#orderid_yun').val(id);
            	}
            </script>
            <script>
         //修改客户状态
         function changeStatus(id,status)
         {
         	swal({   
         		title: "确定要修改状态?",   
         		text: "确认将修改客户的状态!",   
         		type: "warning",   
         		showCancelButton: true,    
         		confirmButtonText: "确认", 
         		cancelButtonText: '取消',
         		closeOnConfirm: false
         	}, function(){
         		$.post('/index/member/changeStatus', {id: id,status:status}, function(data) {
         			if(data.sta == -1 ){
         				swal({
         					title: "权限不足",
         					text: "",
         					type: "error"
         				});
         			}else if(data.sta == 1){
         				swal({
         					title: "修改成功",
         					text: "",
         					type: "success"
         				});
         				window.location.reload();
         			}else{
         				swal({
         					title: "修改失败",
         					text: "",
         					type: "error"
         				});                
         			}
         		});
         	});
         } 
        //导出数据的方法
        function export_data()
        {
        	var attr = '';
        	$.each($('input:checkbox'),function(){
        		if(this.checked){
        			attr += $(this).val()+',';
        		}
        	});
        	attr=attr.substring(0,attr.length-1);
        	if(attr.length<1)/*说明没有选择数据*/
        	{
        		swal({   
        			title: "请选择导出信息",   
        			text: "",   
        			type: "error",  
        		});
        	}else{
        		window.location.href='/index/customer/export/attr/'+attr;
        	}
        }
    </script>
    <script>
    	function delmember(id)
    	{
    		swal({   
    			title: "确定要删除数据?",   
    			text: "确认将删除该条数据!",   
    			type: "warning",   
    			showCancelButton: true,    
    			confirmButtonText: "确认", 
    			cancelButtonText: '取消',
    			closeOnConfirm: false
    		}, function(){   
    			$.post('{:url("index/member/delRechargeRow")}', {'id':id}, function(data) {
    				if(data.sta == -1 ){
    					swal({
    						title: "权限不足",
    						text: "",
    						type: "error"
    					});
    				}else if(data.sta == 1){
    					swal({
    						title: "删除成功",
    						text: "",
    						type: "success"
    					});
    					window.location.reload();
    				}else{
    					swal({
    						title: "删除失败",
    						text: "",
    						type: "error"
    					});                
    				}
    			});
    		});
    	}
    </script>

    {/block}